/*
 * acm2095.c
 *
 *  Created on: 7 Apr 2010
 *      Author: xuxu
 */

#include<stdio.h>
#include<stdlib.h>
int main()
{
	int num[500001];
	int i,j;
	int n;
	int in;
	memset(num,0,sizeof(num));
	for(i=1;i<500001;i++)
	{
		for(j=i+i;j<500001;j+=i)
		{
			num[j]+=i;
		}
	}
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d",&in);
		printf("%d\n",num[in]);
	}
	return 0;
}
